package com.yunshang.shoppingmall.Methods;

import com.yunshang.shoppingmall.entity.ShopTask;
import com.yunshang.shoppingmall.entity.ShopTaskState;
import com.yunshang.shoppingmall.service.ShopTask.ShopTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

@Component
public class ShopTaskMethods {
    @Autowired
    private ShopTaskService shopTaskService;
    private static ShopTaskService shopTaskService1;

    private static List<ShopTask> shoptask;

    @PostConstruct
    public void init() {
        shopTaskService1 = shopTaskService;
    }

    public static List<ShopTask> getListShopTask() {
        if(shoptask==null || ShopTaskState.getUpdate()) {
            shoptask = shopTaskService1.selectShopTaskList();
            ShopTaskState.setUpdate(false);
        }
        return shoptask;
    }

    public static int updateByPrimaryKeySelective(ShopTask record) {
        return shopTaskService1.updateByPrimaryKeySelective(record);
    }

}
